import type { TableColumn, FormField } from '@/components'
import { reactive } from 'vue'

export const fields = reactive<FormField[]>([
  {
    key: 'deptId',
    label: '单位名称',
    tag: 'MTreeSelect',
    attrs: {
      data: [],
      fields: {
        label: 'label',
        value: 'id',
        children: 'children'
      }
    }
  },
  {
    key: 'nickName',
    label: '姓名',
    tag: 'ElInput'
  },
  {
    key: 'workNo',
    label: '工号',
    tag: 'ElInput'
  }
])

export const columns: TableColumn[] = [
  {
    key: 'nickName',
    label: '姓名'
  },
  {
    key: 'phoneNumber',
    label: '手机号'
  },
  {
    key: 'workNo',
    label: '工号'
  },
  {
    key: 'sex',
    label: '性别',
    customRender: (v) => ['男', '女'][v-1] || '未知'
  },
  {
    key: 'unitName',
    label: '单位名称'
  },
  {
    key: 'deptName',
    label: '部门'
  },
  {
    key: 'post',
    label: '职位'
  },
  {
    key: 'actions',
    label: '操作',
    slot: true,
    fixed: 'right'
  }
]
